from django.db import models

fixed_length_for_description    = 800
fixed_length_for_name_slug      = 200
fixed_length_for_history        = 5000
    
class Race(models.Model):
    name        =   models.CharField(max_length=fixed_length_for_name_slug)
    slug        =   models.SlugField(max_length=fixed_length_for_name_slug)
    description =   models.CharField(max_length=fixed_length_for_description)
    history     =   models.TextField()    
    created_at  =   models.DateTimeField()
    
    def __unicode__(self):
        return self.name

class Building(models.Model):
    race        =   models.ForeignKey(Race)
    name        =   models.CharField(max_length=fixed_length_for_name_slug)
    slug        =   models.SlugField(max_length=fixed_length_for_name_slug)
    description =   models.CharField(max_length=fixed_length_for_description)  
    
    def __unicode__(self):
        return self.name  
    
class Mentor(models.Model):
    race        =   models.ForeignKey(Race)
    name        =   models.CharField(max_length=fixed_length_for_name_slug)
    slug        =   models.SlugField(max_length=fixed_length_for_name_slug)
    description =   models.CharField(max_length=fixed_length_for_description)
    created_at  =   models.DateTimeField()
    history     =   models.TextField()
    lvl_below   =   models.IntegerField()
    
    def __unicode__(self):
        return self.name
    
class Skill(models.Model):
    name        =   models.CharField(max_length=fixed_length_for_name_slug)
    slug        =   models.SlugField(max_length=fixed_length_for_name_slug)
    description =   models.CharField(max_length=fixed_length_for_description)
    required_lvl=   models.IntegerField()
    multiplier  =   models.IntegerField()
    delay_time  =   models.IntegerField() 
    
class Unit(models.Model):
    race        =   models.ForeignKey(Race)
    skill       =   models.ForeignKey(Skill)    
    name        =   models.CharField(max_length=fixed_length_for_name_slug)
    slug        =   models.SlugField(max_length=fixed_length_for_name_slug)
    description =   models.CharField(max_length=fixed_length_for_description)
    created_at  =   models.DateTimeField()
    max_lvl     =   models.IntegerField()
    
    def __unicode__(self):
        return self.name
    
class Stat(models.Model):  
    name        =   models.CharField(max_length=fixed_length_for_name_slug)
    slug        =   models.SlugField(max_length=fixed_length_for_name_slug)
    description =   models.CharField(max_length=fixed_length_for_description)
    max_points  =   models.IntegerField()
        
    def __unicode__(self):
        return self.name

class Improvementunit(models.Model):
    unit        =   models.ForeignKey(Unit)
    skill       =   models.ForeignKey(Skill)
    lvl         =   models.IntegerField()
    percentage  =   models.IntegerField()
    
    def __unicode__(self):
        return self.name   